package org.comparator4j.comparator;

import org.comparator4j.Comparator;
import org.comparator4j.CompareContext;
import org.comparator4j.CompareException;

public class NullComparator implements Comparator {

	public Result compare(Object o1, Object o2, CompareContext context)
			throws CompareException {
		if (o1 == null || o2 == null) {
			if (o1 != null) {
				return Result.GT;
			} else if (o2 != null) {
				return Result.LT;
			} else {
				return Result.EQ;
			}
		}
		return context.compare(o1, o2);
	}

}
